home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1994 by Jon Dart. All Rights Reserved.
-
- #include "srclimt2.h"
- #include <wpglob.h>
-
- #define IDP_SEARCHTYPE 101
- #define IDP_NONE 102
- #define IDP_GAME_LIMIT 103
- #define IDP_TOURNAMENT 104
- #define IDP_MOVES_OR_PLY 108
- #define IDP_MINUTES 109
- #define IDP_PLY_TEXT 105
- #define IDP_MINUTES_TEXT 106
-
- WPControlMap SecondaryLimitDialog::ControlMap[] =
- {
- cmRBgp( IDP_SEARCHTYPE, Search_Limit_Options, search_type, 3 )
- cmEdit( IDP_MOVES_OR_PLY, Search_Limit_Options, move_or_ply )
- cmEdit( IDP_MINUTES, Search_Limit_Options, time_limit )
- cmEnd( IDP_SEARCHTYPE )
- };
-
- SecondaryLimitDialog::SecondaryLimitDialog(WPWin *pwin,
- Search_Limit_Options *options)
- : initial_search_type(options->search_type),
- WPDialogModal("SECONDARYLIMITS", pwin, ControlMap, options)
- {
- createWin();
- }
-
- void SecondaryLimitDialog::initDlg()
- {
- // Note: the Windows++ getControl function appears not to return valid
- // data, at least when called from here, so we limit ourselves to direct
- // Windows calls
- const HWND hDlg = getHwnd();
- hPly_field = GetDlgItem(hDlg,IDP_MOVES_OR_PLY);
- hPly_text = GetDlgItem(hDlg,IDP_PLY_TEXT);
- hMinutes_field = GetDlgItem(hDlg,IDP_MINUTES);
- hMinutes_text = GetDlgItem(hDlg,IDP_MINUTES_TEXT);
- new_type(initial_search_type);
- }
-
- void SecondaryLimitDialog::updateObject()
- {
- WPDialog::updateObject();
- }
-
- void SecondaryLimitDialog::updateScreen()
- {
- WPDialog::updateScreen();
- }
-
- void SecondaryLimitDialog::new_type(int srctype)
- {
- assert(srctype < 4);
- switch (srctype)
- {
- case 0: /* None */
- ShowWindow(hMinutes_field,SW_HIDE);
- ShowWindow(hMinutes_text,SW_HIDE);
- ShowWindow(hPly_text, SW_HIDE);
- ShowWindow(hPly_field, SW_HIDE);
- break;
- case 1: /* Game */
- ShowWindow(hMinutes_field,SW_HIDE);
- ShowWindow(hMinutes_text,SW_HIDE);
- EnableWindow(hMinutes_text,FALSE);
- ShowWindow(hPly_field,SW_NORMAL);
- SetWindowText(hPly_text,"Minutes/Game");
- ShowWindow(hPly_text, SW_NORMAL);
- break;
- case 2: /* Tournament */
- ShowWindow(hMinutes_field,SW_SHOWNORMAL);
- ShowWindow(hMinutes_text,SW_SHOWNORMAL);
- EnableWindow(hMinutes_text,TRUE);
- ShowWindow(hPly_field,SW_NORMAL);
- ShowWindow(hPly_text, SW_NORMAL);
- // show the label "Moves:" instead of "Ply:"
- SetWindowText(hPly_text,"Moves:");
- break;
- }
- }
-
- BOOL SecondaryLimitDialog::command(int id, WORD msg)
- {
- switch (id)
- {
- case IDP_NONE:
- new_type(0);
- break;
- case IDP_GAME_LIMIT:
- new_type(1);
- break;
- case IDP_TOURNAMENT:
- new_type(2);
- break;
- default:
- break;
- }
- return WPDialogModal::command(id, msg);
- }
-